/////////////////
//  PREAMBLE  //
////////////////


/*	program:	Analysis-1-NC-NY.do
	author:		David Bateman */
/******************************************************************************/
/***                                                                        ***/
/*** File provides a series of analyses of turnout and party voting in      ***/
/*** New York and North Carolina. The analyses take advantage of the        ***/
/*** unique feature of these states that elections were held at the same    ***/
/*** time, and counted at the same administrative level, but used           ***/
/*** different electoral qualifications.                                    ***/
/***                                                                        ***/
/*** Diff-in-Diff model of turnout:                                         ***/
/*** Turnout_dt = �Tr_d + �Int_t + �(Tr_d * Int_t) + e_dt                   ***/
/***                                                                        ***/
/*** Effect of differential franchise restrictions on votes for the more    ***/
/*** "conservative" party:                                                  ***/
/***                                                                        ***/
/*** Party = �Tr_dt + a_d + e_dt                                            ***/
/***                                                                        ***/
/******************************************************************************/

clear
eststo drop est*
cd "..\..\Dataverse\"

set more off

*** Open New York Early Republic Election File. The election results are from American Antiquarian Society (2007)
*** Most assembly districts were multi-member. The number of voters in each assembly district (LTVote - low threshold)
*** is calculated by dividing the total number (LTVoteTot) by the number of members (membersLA). 
***
*** There are two high threshold offices: Governor (HTVote) and Senator (HTVoteAlt). Since some senators were from
*** multi-member districts, HTVoteAlt is calculated by dividing the total vote (total) by the number of senators (membersSen).
***
*** There are aggregate counties in the dataset. These do not have votes associated with them so inclusion does not affect outcome. 
*** They are not matched for census data but are dropped when observations without simultaneous elections are dropped.
use "Data\New-York-Early-Republic-Election-File.dta", clear

keep if HTVote!=. & LTVote!=.

********************	Turnout in New York 	********************************
*** Calculate the number of votes cast in lower threshold elections that are "missing" from higher threshold elections 
gen dropOff 	= LTVote - HTVote
gen dropOffAlt 	= LTVote - HTVoteAlt
gen dropOffPlac	= HTVoteAlt - HTVote
gen dropPer		= dropOff/LTVote*100
gen dropPerAlt	= dropOffAlt/LTVote*100
gen dropPerPlac	= dropOffPlac/HTVote*100

bys year: egen meanDropPer 		= mean(dropPer)
bys year: egen meanDropPerAlt 	= mean(dropPerAlt)
bys year: egen meanDropPerPlac 	= mean(dropPerPlac)

*** Merge in census data. The census file includes material from the ICPSR Historical, Demographic, Economic, and 
*** Social Data: The United States, 1790-2002 database, as well as information collected from New York State's occasional 
*** state censuses 
 
preserve
	use "Data\ny-adult-male-census-counties.dta", clear
	drop if county==0
	rename state icpsrstate
	duplicates drop name year, force
	tempfile save 
	save `save', replace
restore
merge 1:1 name year using `save'
drop if _merge!=3

*** Calculate turnout against census
preserve
	gen tn1 = LTVote/totalelectors if year<=1821
	gen tn2 = HTVote/pdfreehold250usdin1821 if year<=1821
	summ tn1 tn2
restore

*** Estimate the following model: Turnout_dt =�Tr_d + �Int_t + �(Tr_d * Int_t) + e_dt
preserve
	gen office0 = LTVote / w21m 
	gen office1 = HTVote / w21m 
	egen id_new = group(county year)
	reshape long office, i(id_new) j(tr)
	replace office = office*100
	gen Int = year<=1821

	label define tr 1 "Higher Threshold"  0 "Lower Threshold"
	label values tr tr

	label define Int 1 "Pre-Equalization"  0 "Post-Equalization"
	label values Int Int

	eststo mainNY_to: regress office  i.tr##i.Int, vce(cluster county)

	margins, over(i.Int i.tr )
	marginsplot, recast(scatter) name(mfx_did_to_ny, replace) xsc(reverse)	///
		plot1opts(msy(O) mlw(thin) mlc(black) mfc(white) msize(large))			///
		plot2opts(msy(T) mlw(thin) mlc(black) mfc(gray) msize(large))			///
		ci1opts(lw(thin) lc(black))	 ci2opts(lw(thin) lc(black))  ///
		graphreg(col(none)) xtitle("")  xlab(, angle(h) nogrid labsize(small))	///
		ytitle("") ylab(, nogrid angle(h) labsize(small))	///
		legend(size(small)) title("New York State, 1789-1824", size(small) col(black)) 
		
restore

*** Estimate using different denominators and specifications
foreach x in w21m f21m w16m f16m {
	preserve
		gen office0 = LTVote / `x' 
		gen office1 = HTVote / `x' 
		egen id_new = group(county year)
		reshape long office, i(id_new) j(tr)
		replace office = office*100

		gen Int = year<=1821

		label define tr 1 "Higher Threshold"  0 "Lower Threshold"
		label values tr tr

		label define Int 1 "Pre-Equalization"  0 "Post-Equalization"
		label values Int Int

		eststo supplementNY`x'1: regress office  i.tr##i.Int, vce(cluster county)
		eststo supplementNY`x'2: regress office  i.tr##i.Int gained lost year, vce(cluster county)
		eststo supplementNY`x'3: regress office  i.tr##i.Int if year>=1814 & year<=1824, vce(cluster county)
		
	restore
}

*** NYS figures showing the drop off in county level voting across different offices in simultaneous elections
*** Loss of Assembly voters in Gubernatorial elections. To keep the figure centered between 100 and -100, I 
*** drop one observation from 1789. 
tw	(scatter dropPer year if id!=1228, mlw(vvthin) col(white) mlc(black)) 	///
	(line meanDropPer year , lw(thick) lc(black) sort)					///
	, yline(0, lcol(black) lpat(dash) lw(thin)) 				///
	xline(1821, lcol(black) lpat(dash) lw(thin)) 				///
	graphreg(col(white)) xlabel(1790(5)1825, labsize(small))	///
	ylabel(, angle(h) nogrid labsize(small)) xtitle("") 		///
	ytitle("Additional Votes as Percent of Lower Threshold Total", size(small))	///
	legend(order(1 2) label(1 "District") label(2 "Mean") size(small))	///
	title("New York", size(medsmall) col(black))	///
	name(nyGov, replace)
	
*** Loss of Assembly voters in Senatorial elections
tw	(scatter dropPerAlt  year, 	mlw(vvthin) col(white) mlc(black)) ///
	(line meanDropPerAlt year , lw(thick) lc(black) sort )				///
	, yline(0, lcol(black) lpat(dash) lw(thin)) 				///
	xline(1821, lcol(black) lpat(dash) lw(thin)) 				///
	graphreg(col(white)) xlabel(1790(5)1825, labsize(small))	///
	ylabel(, angle(h) nogrid labsize(small)) xtitle("") 		///
	ytitle("Additional Votes as Percent of Assembly Total", size(small))	///
	legend(order(1 2) label(1 "District") label(2 "Mean") size(small))	///
	title("Assembly and Senate", size(medsmall) col(black))	///
	name(nyAlt, replace)

*** Loss of Senate voters in Gubernatorial elections - placebo
tw	(scatter dropPerPlac year, mlw(vvthin) col(white) mlc(black))	///
	(line meanDropPerPlac year , lw(thick) lc(black) sort) 				///
	, yline(0, lcol(black) lpat(dash) lw(thin)) 				///
	xline(1821, lcol(black) lpat(dash) lw(thin)) 				///
	graphreg(col(white)) xlabel(1790(5)1825, labsize(small))	///
	ylabel(, angle(h) nogrid labsize(small)) xtitle("") 		///
	ytitle("Additional Votes as Percent of Senate Total", size(small))	///
	legend(order(1 2) label(1 "District") label(2 "Mean") size(small))	///
	title("Senate and Governor (Placebo)", size(medsmall) col(black))	///
	name(nyPlacebo, replace)

********************	Party Vote in New York 	********************************
preserve
	
	*** Analysis of party vote in early Republic New York
	
	*** Generate the party vote share in the HT and LT electorates. 
	*** party1 is always the Federalist / Clintonian vote; party2 is the Republican
	*** or Bucktail vote. 
	gen perP1	= party1HT / HTVote*100
	gen perP2	= party1LTTot / LTVoteTot*100
	
	gen diff = perP1 - perP2

	hist diff if year<=1821, col(none) lc(gs10) lw(vvthin) kdensity percent bin(100) 	///
		xline(0, lc(black)) graphreg(col(none)) kdenopts(lcol(black))		///
		ylab(,nogrid angle(h) labsize(small)) xtitle("") ytitle("") xlab(,labsize(small))	///
		name(hist_ny, replace)  title("New York, 1789-1821", size(small) col(black))
			
	*** reshape
	reshape long perP , i(id) j(office)
	gen tr = office==1
	gen Int = year<=1821

	label define tr 1 "Higher Threshold"  0 "Lower Threshold"
	label values tr tr

	label define Int 1 "Pre-Equalization"  0 "Post-Equalization"
	label values Int Int

	xtset id
	
	*** Model for Table 3: Party = �Tr_dt + a_d + e_dt 
	*** Controls are not included in this case. Fixed effects are included at the
	*** county/election level. It is a within-county, same-year comparison betweem
	*** HT and LT results. 
	eststo mainNY_pv: xtreg perP tr if year<=1821 , fe cluster(place)
	estadd local ctrls "No"
	estadd local fixed "Yes"

	*** Alternative specifications for the supplemental material, including a 
	*** diff-in-diff specification. We cannot make strong claims about the partisanship
	*** of voters in the two electorates. We can say that the non-Democratic party 
	*** generally did slightly better in the HT electorate. 
	eststo supplementalNY1: xtreg perP tr if year<=1821 & year>=1800, fe cluster(place)
	estadd local fixed "Yes"
	eststo supplementalNY2: xtreg perP tr if year<=1814 & year>=1800, fe cluster(place)
	estadd local fixed "Yes"
	eststo supplementalNY3: xtreg perP tr if year<=1821 & year>=1814, fe cluster(place)
	estadd local fixed "Yes"
	eststo supplementalNY4: regress perP  i.tr##i.Int if year>=1800, vce(cluster id)
	margins, over(i.Int i.tr )
	marginsplot, recast(scatter) name(mfx_did_pv_ny, replace) xsc(reverse)	///
		plot1opts(msy(O) mlw(thin) mlc(black) mfc(white) msize(large))			///
		plot2opts(msy(T) mlw(thin) mlc(black) mfc(gray) msize(large))			///
		ci1opts(lw(thin) lc(black))	 ci2opts(lw(thin) lc(black))  ///
		graphreg(col(none)) xtitle("")  xlab(, angle(h) nogrid labsize(small))	///
		ytitle("Non-Democratic Party Vote Share") ylab(, nogrid angle(h) labsize(small))		///
		legend(size(small)) title("New York State, 1800-1824", size(small) col(black)) 

	*** Examine the over time trend in the aggregate share of votes by the non-Democratic party
	*** in the recovered election data. 
	collapse perP diff (sd) sd=diff, by(year tr)
	tw line perP year if tr==1, lc(black) || line perP year if tr==0, lc(black) lp(dash)	///
		graphreg(col(white)) ylabel(, angle(h) nogrid labsize(small)) ytitle("Non-Democratic Party Vote Share", size(small))	///
		xline(1821, lp(dash) lc(black)) xtitle("") xlab(, labsize(small)) title("New York", size(small) col(black)) ///
		legend(label(1 "High Qualification") label(2 "Low Qualification") size(small))	name(ptNY, replace)	

	*** Examine the over time trends in the average county level difference in party vote share
	*** as well as the standard deviation in the size of this difference for each year.
	tw line diff year if tr==1, lc(black) || line sd year if tr==0, lc(black) lp(dash)	///
		graphreg(col(white)) ylabel(, angle(h) nogrid labsize(small)) ytitle("Difference in Party Vote Shares", size(small))	///
		xline(1821, lp(dash) lc(black)) yline(0, lw(vvthin) lc(black)) xtitle("") xlab(, labsize(small)) title("New York", size(small) col(black)) ///
		legend(label(1 "Avg. Difference") label(2 "Standard Deviation") size(small))	name(diff_time_ny, replace)	
		
restore
	
	
*****************************************************************************
************************		NORTH CAROLINA		*************************
*****************************************************************************
set more off
label drop _all

*** Open North Carolina Early Republic Election File. The election results are from American Antiquarian Society (2007)
*** and the ICPSR Historical Elections Series (1999) plus historical newspapers. 
***
*** The low threshold elections were for the House of Commons and Governor (post-1835). After 1835, the gubernatorial elections
*** are used. Before that, votes for the House were used. These are used only for the Figure of votes lost from moving from the
*** low to high threshold election. 
***
*** Data is included at the county and precinct level (level = 2, county; level = 3, precinct). All counties had two members of 
*** the House of Commons and one senator. After 1835, each district had 1 senator but some districts were amalgamated. 
*** The individual voters for the House are calculated by dividing the total number of votes cast by 2. For the Senate, each voter
*** only had one vote, since even in amalgamated counties they voted for only one senator.
use "Data\North-Carolina-Election-File.dta", clear

keep if HTVote!=. & LTVote!=.
gen dropOff 	= LTVote - HTVote
gen dropPer		= dropOff/LTVote*100

*** There is a clear outlier in Cumberland county. Fayetteville reported returns for the Senate but not the House.										
drop if dropPer<=-300
bys year: egen meanDropPer = mean(dropPer)
	
preserve
	use "Data\adult-male-census-counties.dta", clear
	keep if state==47
	gen level = 2
	rename state icpsrstate
	duplicates drop name year, force
	tempfile save 
	save `save', replace
restore
merge m:1 name year using `save'
*** Keep the precincts for the drop-off figure
drop if _merge==2

*** Estimate the following model: Turnout_dt =�Tr_d + �Int_t + �(Tr_d * Int_t) + e_dt
preserve
	gen office0 = LTVote / w21m
	gen office1 = HTVote / w21m 
	egen id = group(name year)
	drop if precinct!=.
	reshape long office, i(id) j(tr)
	replace office = office*100

	gen Int = year<=1857
	drop if year<1835
	label define tr 1 "Higher Threshold"  0 "Lower Threshold"
	label values tr tr

	label define Int 1 "Pre-Equalization"  0 "Post-Equalization"
	label values Int Int

	eststo mainNC_to: regress office  i.tr##i.Int, vce(cluster name)
	margins, over(i.Int i.tr )
	marginsplot, recast(scatter) name(mfx_did_to_nc, replace) xsc(reverse)	///
		plot1opts(msy(O) mlw(thin) mlc(black) mfc(white) msize(large))			///
		plot2opts(msy(T) mlw(thin) mlc(black) mfc(gray) msize(large))			///
		ci1opts(lw(thin) lc(black))	 ci2opts(lw(thin) lc(black))  ///
		graphreg(col(none)) xtitle("") xlab(, angle(h) nogrid labsize(small))	///
		ytitle("") ylab(, nogrid angle(h) labsize(small))		///
		legend(size(small)) title("North Carolina, 1836-1860", size(small) col(black)) 		
		
restore

*** Estimate using different denominators and specifications for suppl. material

foreach x in w21m w16m {
	preserve
		gen office0 = LTVote / `x' 
		gen office1 = HTVote / `x' 
		egen id = group(name year)
		drop if precinct!=.
		reshape long office, i(id) j(tr)
		replace office = office*100

		gen Int = year<=1857
		drop if year<1835
		
		label define tr 1 "Higher Threshold"  0 "Lower Threshold"
		label values tr tr

		label define Int 1 "Pre-Equalization"  0 "Post-Equalization"
		label values Int Int

		eststo supplementNC`x'1: regress office  i.tr##i.Int, vce(cluster name)
		eststo supplementNC`x'2: regress office  i.tr##i.Int gained lost year, vce(cluster county)
		eststo supplementNC`x'3: regress office  i.tr##i.Int gained lost year uncontested, vce(cluster county)
		eststo supplementNC`x'4: regress office  i.tr##i.Int if year>=1848 & year<=1860, vce(cluster county)
		
	restore
}


*** NC figures showing the drop off in county level voting across different offices in simultaneous elections
tw	(scatter dropPer  year, mlw(vvthin) col(white) mlc(black))	///
	(line meanDropPer year if year<=1825, lw(thick) lc(black) sort)		///
	(line meanDropPer year if year>=1836, lw(thick) lc(black) sort)		///
	, yline(0, lcol(black) lpat(dash) lw(thin)) 				///
	xline(1857, lcol(black) lpat(dash) lw(thin)) 				///
	graphreg(col(white)) xlabel(1790(15)1865, labsize(small))	///
	ylabel(, angle(h) nogrid labsize(small)) xtitle("") 		///
	ytitle("", size(small))	///
	legend(order(1 2) label(1 "District") label(2 "Mean") size(small))	///
	title("North Carolina", size(medsmall) col(black))	///
	name(nc, replace)

******************	Party Vote in North Carolina 	****************************

preserve
	
	*** Analysis of party vote in North Carolina
	
	*** Generate the party vote share in the HT and LT electorates. 
	*** party1 is the Federalist in early Republic, and Whigs in antebellum era
	*** party2 is the Republican (early Republic) or Democratic party (antebellum)
	gen perP1		= party1HT / HTVote*100
	gen perP2		= party1LTTot / LTVoteTot*100 if year<1835
	*** LT is easier to estimate post-1835 because it is for governor not multi-member commoners.
	replace perP2	= party1LT / LTVote*100 if year>=1835 & year!=.

	keep year name perP1 perP2  
	egen id = group(year name)
	gen diff = perP1 - perP2
		
	hist diff if year<=1826, col(none) lc(gs10) lw(vvthin) kdensity percent bin(25) 	///
		xline(0, lc(black)) graphreg(col(none)) kdenopts(lcol(black))		///
		ylab(,nogrid angle(h) labsize(small)) xtitle("") ytitle("") xlab(,labsize(small))	///
		name(hist_nc1, replace)  title("North Carolina, 1789-1821", size(small) col(black))
	hist diff if year>=1830 & year<=1856, col(none) lc(gs10) lw(vvthin) kdensity percent bin(100) 	///
		xline(0, lc(black)) graphreg(col(none)) kdenopts(lcol(black))		///
		ylab(,nogrid angle(h) labsize(small)) xtitle("") ytitle("") xlab(,labsize(small))	///
		name(hist_nc2, replace)  title("North Carolina, 1836-1856", size(small) col(black))

	*** reshape
	reshape long perP, i(id) j(office)
	gen tr = office==1
	gen Int = year<=1857

	label define tr 1 "Higher Threshold"  0 "Lower Threshold"
	label values tr tr

	label define Int 1 "Pre-Equalization"  0 "Post-Equalization"
	label values Int Int

	xtset id
	
	*** Model for Table 3: Party = �Tr_dt + a_d + e_dt 
	*** Controls are not included in this case. Fixed effects are included at the
	*** county/election level. It is a within-county, same-year comparison betweem
	*** HT and LT results. 
	eststo mainNC1_pv: xtreg perP tr if year<=1826 , fe cluster(name)
	estadd local ctrls "No"
	estadd local fixed "Yes"
	eststo mainNC2_pv: xtreg perP tr if year>1835 & year<=1856, fe cluster(name)
	estadd local ctrls "No"
	estadd local fixed "Yes"

	*** Alternative specifications for the supplemental material, including a 
	*** diff-in-diff specification. We cannot make strong claims about the partisanship
	*** of voters in the two electorates. We can say that the non-Democratic party 
	*** generally did slightly better in the HT electorate. 
	eststo supplementalNC1: xtreg perP tr if year<=1826 & year>=1800, fe cluster(name)
	estadd local fixed "Yes"
	eststo supplementalNC2: xtreg perP tr if year<=1856 & year>=1848, fe cluster(name)
	estadd local fixed "Yes"
	eststo supplementalNC3: xtreg perP tr if year<=1860 & year>=1857, fe cluster(name)
	estadd local fixed "Yes"
	eststo supplementalNC4: regress perP  i.tr##i.Int if year>=1840, vce(cluster id)
	margins, over(i.Int i.tr )
	marginsplot, recast(scatter) name(mfx_did_pv_nc, replace) xsc(reverse)	///
		plot1opts(msy(O) mlw(thin) mlc(black) mfc(white) msize(large))			///
		plot2opts(msy(T) mlw(thin) mlc(black) mfc(gray) msize(large))			///
		ci1opts(lw(thin) lc(black))	 ci2opts(lw(thin) lc(black))  ///
		graphreg(col(none)) xtitle("")  xlab(, angle(h) nogrid labsize(small))	///
		ytitle("") ylab(, nogrid angle(h) labsize(small))	///
		legend(size(small)) title("North Carolina, 1840-1860", size(small) col(black)) 

	*** Examine the over time trend in the aggregate share of votes by the non-Democratic party
	*** in the recovered election data. The early Republic has too few obs. 
	collapse perP diff (sd) sd=diff, by(year tr)
	tw line perP year if tr==1 & year>=1830, lc(black) || line perP year if tr==0  & year>=1830, lc(black) lp(dash)	///
		graphreg(col(white)) ylabel(, angle(h) nogrid labsize(small)) ytitle("Non-Democratic Party Vote Share", size(small))	///
		xline(1857, lp(dash) lc(black)) xtitle("") xlab(, labsize(small)) title("North Carolina", size(small) col(black)) ///
		legend(label(1 "High Qualification") label(2 "Low Qualification") size(small))	name(ptNC, replace)	

	*** Examine the over time trends in the average county level difference in party vote share
	*** as well as the standard deviation in the size of this difference for each year. The early Republic has too few obs. 
	tw line diff year if tr==1  & year>=1830, lc(black) || line sd year if tr==0  & year>=1830, lc(black) lp(dash)	///
		graphreg(col(white)) ylabel(, angle(h) nogrid labsize(small)) ytitle("Difference in Party Vote Shares", size(small))	///
		xline(1857, lp(dash) lc(black)) yline(0, lw(vvthin) lc(black)) xtitle("") xlab(, labsize(small)) title("North Carolina", size(small) col(black)) ///
		legend(label(1 "Avg. Difference") label(2 "Standard Deviation") size(small))	name(diff_time_nc, replace)	

restore

	

********************************************************************************
*****************		Combine Figures and tables		************************
********************************************************************************

****************				Main Text 				************************
*** Turnout
*** Figure 3: Additional Votes in Lower Threshold Elections Pre/Post-Equalization
grc1leg nyGov nc, graphreg(col(white)) ycommon imargin(small)	///
		note("Calculated as the number of votes cast for lower threshold elections minus those cast in higher threshold elections, as percent of the first.""Vertical dashed lines mark franchise equalization.", size(vsmall) col(black))
graph export "Figures/Figure-3.pdf", replace

*** Table 2: Difference in Difference of Voter Turnout in New York and North Carolina

esttab mainNY_to mainNC_to using "Tables/Table-2.tex", se(a2)  label  	///
	title(Difference-in-Difference Regression of County-Level Voter Turnout in New York and North Carolina) 	///
	drop(0.Int 0.tr 0.tr#1.Int 0.tr#0.Int 1.tr#0.Int _cons)  ///
	coeflabels(1.tr "Higher Threshold ($\beta$)" 1.Int "Pre-Equalization ($\delta$)" 1.tr#1.Int "Interaction ($\gamma$)")	///
	nonumbers mgroups("New York" "North Carolina", pattern(1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span )         ///
	mtitles("1789-1824" "1836-1860" ) nogaps nodepvars	nostar noconstant nonotes  ///
	stats(N_clust  N, fmt(%9.0g) label("Counties" "N")) b(a3)				///
	note("Standard errors clustered at the county-level.") 				///
	nolines prehead(\begin{table}[hbt!]\centering	\caption{@title} \label{tab:2} \begin{tabular}{l*{@M}{c}} \toprule)		///		
	posthead(\midrule)  prefoot(\midrule)		///
	postfoot(\bottomrule \multicolumn{3}{l}{\footnotesize @note} \end{tabular} \end{table})   tex    replace

*** Table 3: Party Voting 
esttab mainNY_pv mainNC1_pv mainNC2_pv using "Tables/Table-3.tex", se(a2)  label 	///
	title(Effect of Franchise Qualifications on Federalist/Whig Vote Share) 	///
	drop( _cons) nonumbers 	coeflabels(tr "Higher Threshold ($\beta$)" )	///
	mgroups("New York" "North Carolina", pattern(1 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span )         ///
	mtitles("1789-1821" "1789-1826" "1836-1856" ) nogaps nodepvars nostar compress noconstant nonotes	 		///
	stats(ctrls fixed N_g N, fmt(%9.0g) label("Additional controls" "County/year fixed effects" "Counties" "N")) b(a3) 						///
	nolines prehead(\begin{table}[hbt!]\centering	\caption{@title} \label{tab:3} \begin{tabular}{l*{@M}{c}} \toprule)		///		
	posthead(\midrule)  prefoot(\midrule) ///
	postfoot(\bottomrule \end{tabular} \floatnote{Standard errors clustered at the county-level.} \end{table})   tex    replace

	
****************			Supplemental Material			********************
*** Tables:
***
*** Supplemental Table 6: Diff-in-diff analysis of turnout in NYS, using different 
*** denominators to estimate turnout. 
esttab  supplementNYf16m1 supplementNYf21m1 supplementNYw21m2 supplementNYw21m3 	///
	using "Tables/Supplemental/Supplemental-Table-6.tex", se(a2)  label 	///
	title(Difference-in-Difference Regressions of County-Level Voter Turnout in New York and North Carolina) 	///
	drop(0.Int 0.tr 0.tr#1.Int 0.tr#0.Int 1.tr#0.Int _cons)	///
	coeflabels(1.tr "Higher Threshold ($\beta$)" 1.Int "Pre-Equalization ($\delta$)" gained "County gained area" lost "County lost area" year "Year" 1.tr#1.Int "Interaction ($\gamma$)")	///
	addnotes("Standard errors clustered at the county-level.") interaction(" * ")	///
	mtitles("\shortstack{Free Men, 16\\(1789-1824)}" "\shortstack{Free Men, 21\\(1789-1824)}" "\shortstack{White Men, 21\\(1789-1824)}" "\shortstack{White Men, 21\\(1814-1824)}" ) nogaps nodepvars	///
	nostar compress noconstant stats(N_clust  N, fmt(%9.0g)) b(a3) 		///
	nolines prehead(\begin{table}[hbt!]\centering	\caption{@title} \label{tab:A6} \begin{tabular}{l*{@M}{c}} \toprule)		///		
	posthead(\midrule)  prefoot(\midrule) ///
	postfoot(\bottomrule \end{tabular})   tex    replace

esttab supplementNCw16m1 supplementNCw21m2 supplementNCw21m3 supplementNCw21m4 using 				///
	"Tables/Supplemental/Supplemental-Table-6.tex", se(a2)  label 	///
	drop(0.Int 0.tr 0.tr#1.Int 0.tr#0.Int 1.tr#0.Int _cons)	///
	coeflabels(1.tr "Higher Threshold ($\beta$)" 1.Int "Pre-Equalization ($\delta$)" gained "County gained area" lost "County lost area" year "Year" 1.tr#1.Int "Interaction ($\gamma$)" uncontested "Uncontested")	///
	addnotes("Standard errors clustered at the county-level.") 	///
	mtitles("\shortstack{White Men, 16\\(1836-1860)}" "\shortstack{White Men, 21\\(1836-1860)}" "\shortstack{White Men, 21\\(1836-1860)}" "\shortstack{White Men, 21\\(1848-1860)}" ) nogaps nodepvars	///
	nostar compress noconstant stats(N_clust  N, fmt(%9.0g)) b(a3) 	///
		nolines prehead(\begin{tabular}{l*{@M}{c}} \toprule)		///		
	posthead(\midrule)  prefoot(\midrule) ///
	postfoot(\bottomrule \end{tabular} \floatnote{Standard errors clustered at the county-level. Age is equal or older.} \end{table})   tex    append

*** Supplemental Table 11: Different date specifications of effect of higher threshold 
*** on party vote share in NY and NC
esttab supplementalNY1 supplementalNY2 supplementalNY3 using "Tables/Supplemental/Supplemental-Table-11.tex", se(a2)  label 	///
	title(Different Specifications of Effect of Franchise on Non-Democratic Vote Share) 	///
	drop( _cons) nonumbers 	coeflabels(tr "Higher Threshold, New York ($\beta$)" )	///
	mtitles("1800-1821" "1800-1814" "1814-1821" ) nogaps nodepvars nostar compress noconstant nonotes	 		///
	stats(fixed N_g N, fmt(%9.0g) label("County/year fixed effects" "Counties" "N")) b(a3) 						///
	nolines prehead(\begin{table}[hbt!]\centering	\caption{@title} \label{tab:A11} \begin{tabular}{l*{@M}{c}} \toprule)		///		
	posthead(\midrule)  prefoot(\midrule) fragment postfoot(\midrule) tex    replace

esttab supplementalNC1 supplementalNC2 supplementalNC3 using "Tables/Supplemental/Supplemental-Table-11.tex", se(a2)  label 	///
	title(Different Specifications of Effect of Franchise on Federalist/Whig/Opposition Vote Share, North Carolina) 	///
	drop( _cons) nonumbers 	coeflabels(tr "Higher Threshold, North Carolina ($\beta$)" )	///
	mtitles("1800-1826" "1848-1856" "1857-1860" ) nogaps nodepvars nostar compress noconstant nonotes	 		///
	stats(fixed N_g N, fmt(%9.0g) label("County/year fixed effects" "Counties" "N")) b(a3) 						///
	nolines  prefoot(\midrule) ///
	postfoot(\bottomrule \end{tabular} \floatnote{Standard errors clustered at the county-level.}  \end{table}) fragment  tex    append

*** Supplemental Table 12: Diff-in-diff analysis of party vote share in NYS and NC 
esttab supplementalNY4 supplementalNC4	///
	using "Tables/Supplemental/Supplemental-Table-12.tex",	///
	se(a2)  label title(Difference-in-Difference Regression of County-Level Vote for Non-Democratic Party in New York and North Carolina) 	///
	drop(0.Int 0.tr 0.tr#1.Int 0.tr#0.Int 1.tr#0.Int _cons)  ///
	coeflabels(1.tr "Higher Threshold ($\beta$)" 1.Int "Pre-Equalization ($\delta$)" 1.tr#1.Int "Interaction ($\gamma$)")	///
	mgroups("New York" "North Carolina", pattern(1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span )         ///
	mtitles("1800-1824" "1840-1860" ) nonumbers nogaps nodepvars nostar compress noconstant nonotes	 		///
	stats(N_clust N, fmt(%9.0g) label("Counties" "N")) b(a3) 						///
	nolines prehead(\begin{table}[hbt!]\centering	\caption{@title} \label{tab:A12} \begin{tabular}{l*{@M}{c}} \toprule)		///		
	posthead(\midrule)  prefoot(\midrule) ///
	postfoot(\bottomrule \end{tabular} \floatnote{Standard errors clustered at the county-level.} \end{table})   tex    replace

	
*** Figures:
***	
*** Supplemental Figure: Additional Votes in New York Elections, Alternative Specifications
grc1leg nyAlt nyPlacebo, graphreg(col(white)) ycommon imargin(small)	
graph export "Figures/Supplemental/Supplemental-Figure-4.pdf", replace

*** Supplemental Figure: Marginal Effects of NY/NC Difference in Difference on turnout
grc1leg mfx_did_to_ny mfx_did_to_nc, graphreg(col(white)) ycommon	///
		note("Turnout calculated as percent of estimated 21+ white males.", size(vsmall))
graph export "Figures/Supplemental/Supplemental-Figure-5.pdf", replace

*** Supplemental Figure: Marginal Effects of NY/NC Difference in Difference on party vote share
grc1leg mfx_did_pv_ny mfx_did_pv_nc, graphreg(col(white)) ycommon	///
		note("Non-Democratic party is either Federalists or Clintonians (New York) or Whigs, Know-Nothing, or Opposition (North Carolina).", size(vsmall))	
graph export "Final/January-2020-Submission-Files/Replication-Files-October-2023/Figures/Supplemental/Supplemental-Figure-7.pdf", replace

graph combine hist_ny hist_nc1 hist_nc2, graphreg(col(white)) row(1) imargin(tiny) xcommon	///
	l1title("Density", size(vsmall))  b1title("Difference in Non-Democratic Party's Vote Share in High minus Low Threshold Electorate", col(black) size(small))
graph export "Figures/Supplemental/Supplemental-Figure-8.pdf", replace
	
*** Additional figures not included in supplemental material. They show the average
*** difference in party voting in higher/lower threshold electorates across the state. 
*** Negative numbers favor the Federalists/Whigs. In both states the difference fluctuates
*** around zero. Cross-county variation in the difference between the parties
*** across the different thresholds starts off high and declines in both states, 
*** before returning to high levels in North Carolina.
grc1leg ptNY ptNC, graphreg(col(white)) ycommon	///
		note("Non-Democratic party is either Federalists or Clintonians (New York) or Whigs, Know-Nothing, or Opposition (North Carolina).", size(vsmall))	///
		title("Trends in Party Vote Share Across Franchise Regimes", size(small) col(black))

grc1leg diff_time_ny diff_time_nc, graphreg(col(white)) ycommon	///
		note("Non-Democratic party is either Federalists or Clintonians (New York) or Whigs, Know-Nothing, or Opposition (North Carolina).", size(vsmall))	///
		title("Magnitude and Variation in Difference in Party Vote Share", size(small) col(black))

	